﻿using log4net;
using System.Collections.Generic;
using System.Web.Http;
using OF.Component.Model;
using System;

namespace LogCenter.Controllers
{
    /// <summary>
    /// 操作日志
    /// </summary>
    public class ActionLogController : BaseController
    {
        //初始化自定义的日志类别 DataLogAdoAppenderLogger
        private ILog logger = LogManager.GetLogger("ActionLogAdoAppenderLogger");
        /// <summary>
        ///  添加
        /// </summary>
        /// <param name="log">日志实体</param>
        [HttpPost,Route("ActionLog")]
        public void Add(OperationLogInfo log)
        {
            log.CreatedDate = DateTime.Now;
            logger.Info(log);
        }
        /// <summary>
        /// 暂不实现;获取列表
        /// </summary>
        [HttpGet, Route("ActionLog")]
        public List<OperationLogInfo> Get()
        {
            return new List<OperationLogInfo>();
        }
        /// <summary>
        /// 暂不实现;根据ID取单条数据
        /// </summary>
        /// <param name="logId"></param>
        /// <returns></returns>
        [HttpGet, Route("ActionLog/{logId}")]
        public OperationLogInfo Get(long logId)
        {
            return new OperationLogInfo();
        }
    }
}